-
Notifications
You must be signed in to change notification settings - Fork 87
Fixes order in which default initializers are injected #119
Conversation
Reproduce issue zendframework#100 without mvc and modulemanager dependencies
Uses the test from zendframework#117 to find a solution for zendframework#100 by overriding `configure()` to first remove the default initializers from the initializer stack if present, and then push them on in the appropriate positions once configuration is complete.
use Zend\ServiceManager\InitializerInterface; | ||
use Zend\ServiceManager\ServiceLocatorInterface; | ||
|
||
class DependancyInitializer implements InitializerInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dependacy
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remembered to fix that too late; have it fixed locally, and will include in the merge if the rest looks good. (That came from the PR that provided the tests! w00t for PRs with tests!)
- Ensure consistent license on new files, with correct year - `s/Dependancy/Dependency/g` - Added dockblocks on new class methods and properties
Removes need for additional test asset classes by using mock objects to test behavior of initializers. Adds a test to verify that the plugin manager injected into a form's factory is the application form element manager.
Marking as a WIP, as I'm refactoring the tests to use mock objects as spies, and writing a test to verify the secondary behavior of ensuring that the |
<?php | ||
/** | ||
* @link http://github.com/zendframework/zend-servicemanager for the canonical source repository | ||
* @copyright Copyright (c) 2016 Zend Technologies USA Inc. (http://www.zend.com) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copyright wording inconsistency
Adds a unit test to ensure that the `injectFactory()` initializer is injected prior to the `callElementInit()` initializer, and updates the V2 polyfill to ensure the behavior is correct. A new test asset was created to help spy on behavior.
Test covering the behavior " |
$formElementManagerConfig = new Config([ | ||
'factories' => [ | ||
'MyForm' => function () { | ||
return new TestAsset\Form(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ocramius Had to use a test asset here. When I tried mocking, I was hitting out-of-memory errors. Worked fine for the initializers, but not for the form.
Uses the test from #117 to find a solution for #100 by overriding
configure()
to first remove the default initializers from the initializer stack if present, and then push them on in the appropriate positions once configuration is complete.